package chapter02

object Test04_String {
  def main(args: Array[String]): Unit = {
    val name: String = "alice"
    val age: Int = 10
    println(age + "岁的" + name + "在学校")
    //*用于将一个字符串复制多次拼接
    println(name * 3)
    //字符串格式化输出
    printf("%d 岁的 %s 在学校学习 \n", age, name)
    //字符串模板
    println(s"${age}岁的${name}在学习")
    val num: Float = 2.355656f
    println(f"The num is ${num}%2.2f ") //格式化模板字符串
    println(raw"The num is ${num}%2.2f")
    //三引号表示字符串,保持多行字符串的原格式输出
    val sql =
      s"""
         |select  *
         |from
         |student
         |where
         | name = ${name}
         |and
         | age > ${age}
         |""".stripMargin
    println(sql)
  }
}
